﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="sys_user_list.aspx.cs" Inherits="Ccit.SysPlat.Organ.sys_user_list" %>
<%@ Register TagPrefix="ccit" Namespace="Ccit.ServerControls" Assembly="Ccit.ServerControls.ActionForm" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v8.1" namespace="DevExpress.Web.ASPxGridView" tagprefix="dxwgv" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v8.1" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>
<html>
<head runat="server">
    <title></title>
    <script language="javascript" src="../script/jwindow.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jquery.js" type="text/javascript"></script>
    <script language="javascript" src="../script/jbase64.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
    <!--
        function OnGridSelectionChanged() {
            grid.GetSelectedFieldValues("USERID", OnGridSelectionComplete);
        }

        function OnGridSelectionComplete(values) {
            $get("_hidSelId").value = values;

            //var spanSelected = document.getElementById("spSelect");
            //spanSelected.innerText = strSelected;   
        }

        function UpdateCustomizationWindowValue() {
            var element = document.getElementById("btnCustWindow");
            if (element == null) return;
            element.value = (grid.IsCustomizationWindowVisible() ? "Hide" : "Show") + " Customization Window";
        }
        function ShowHideCustomizationWindow() {
            if (grid.IsCustomizationWindowVisible())
                grid.HideCustomizationWindow();
            else grid.ShowCustomizationWindow();
            UpdateCustomizationWindowValue();
        }

        /* FuncDesc:   上下移动用户显示顺序记录
        * FuncParam:  pUserId: 用户ID
        *             pType:   移动类型 0:上移; 1:下移 
        * FuncReturn: void
        */
        function doMove(pUserId, pOrder, pType) {
            PageMethods.ModeSingleStep(pUserId, pOrder, pType, ClientCallBack);
        }

        /* FuncDesc:   调整显示顺序
        * FuncParam:  pUserId: 用户ID
        *             pOrder: 记录调整前的显示顺序
        *             pMoveToOrder: 要移动到的显示顺序数字 
        * FuncReturn: void
        */
        function doMoveTo(pUserId, pOrder, pMoveToOrder) {

        }

        /* FuncDesc:   点击显示顺序列的修改按钮触发事件
        * FuncParam:  pRowIndex: 所在行的索引号 
        * FuncReturn: void
        */
        function doModifyOrder(pRowIndex) {

        }

        /* FuncDesc:   点击操作列修改按钮触发事件
        * FuncParam:  pUserId: 用户ID 
        * FuncReturn: void
        */
        function doEdit(pUserId) {
            var organId = $get("_hidOrganId").value;
            var delSign = $get("_hidDelSign").value;
            var vPageParam = "organId=" + organId + "&userId=" + pUserId + "&delSign=" + delSign;
            var encodeParam = base64encode(vPageParam);
            var strURL = "./sys_user_edit.aspx?" + encodeParam;
            parent.document.location.href = strURL;
            return false;
        }

        /* FuncDesc:   点击操作列删除或恢复按钮触发事件
        * FuncParam:  pUserId: 用户ID 
        *             pOperType: 操作类型 0:删除； 1:恢复
        * FuncReturn: void
        */
        function doDelResume(pUserId, pOperType) {
            if (!confirm("删除当前用户记录,是否继续?")) return false;

            if (pOperType == "0") //删除记录
                PageMethods.BatDelUsers(pUserId, ClientCallBack);
            else
                PageMethods.Resume(pUserId, ClientCallBack);
            return false;
        }
       
        function ClientCallBack(vResult) {
            if (null == vResult || vResult == "undefined") {
                alert("网络传输错误,没有正确的返回值,请检查网络是否畅通!");
                return;
            }
            eval("var resultObj=" + vResult);
            var operType = resultObj.OPERTYPE;
            switch (operType) {
                case "DELETE":
                    if (parseInt(resultObj.RSTSIGN) > 0) __doPostBack("lnbCallBack", "");
                    else alert(resultObj.RSTMSG);
                    break;
                case "RESUME":
                    if (parseInt(resultObj.RSTSIGN) > 0) __doPostBack("lnbCallBack", "");
                    else alert(resultObj.RSTMSG);
                    break;
                case "RESUMEPWD":
                    if (parseInt(resultObj.RSTSIGN) > 0) __doPostBack("lnbCallBack", "");
                    else alert(resultObj.RSTMSG);
                    break;

            }
            resultObj = null;        
        }

        /* FuncDesc:   批量删除用户
        * FuncParam:  none
        * FuncReturn: void
        */
        function doBatDelete() {
            var selIds = $get("_hidSelId").value;
            if (selIds == "") {
                alert("请选择要删除的用户!");
                return;
            }
            PageMethods.BatDelUsers(selIds, ClientCallBack);
        }

        /* FuncDesc:   恢复用户口令
        * FuncParam:  none
        * FuncReturn: void
        */
        function doResumePwd() {
            var selIds = $get("_hidSelId").value;
            if (selIds == "") {
                alert("请选择用户!");
                return;
            }

            PageMethods.ResumePwd(selIds, ClientCallBack);
        }

        function doSelALLUser() {
            $get("_hidSelALLSign").value = "1";
            __doPostBack("lnbSel", "");
        }

        function doUnSelALLUser() {
            $get("_hidSelALLSign").value = "0";
            __doPostBack("lnbSel", "");
        }
       
    //-->
    </script>
</head>
<body>
    <ccit:ActionForm id="form1" runat="server">  
    <input type="hidden" id="_hidOrganId" runat="server" />
    <input type="hidden" id="_hidDelSign" runat="server" /> 
    <input type="hidden" id="_hidSelId" />  
    <input type="hidden" id="_hidSelALLSign" runat="server" />
    <asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server">
    </asp:ScriptManager>   
    <table cellpadding="0" cellspacing="0" width="100%">
       <tr>
          <td>
             <dxwgv:ASPxGridView ID="grid"                              
                    Width="100%" 
                    AutoGenerateColumns="False" 
                    KeyFieldName="USERID"
                    Settings-ShowFooter="false"
                    onhtmlrowcreated="grid_RowCreated"
                    runat="server" onprocesscolumnautofilter="grid_ProcessColumnAutoFilter" >
                <Columns>                
                <%-- 复选框选择--%>
                <dxwgv:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" Width="3%">
                     <HeaderTemplate>
                      <input type="checkbox" onclick="grid.SelectAllRowsOnPage(this.checked);" style="vertical-align:middle;" title="Select/Unselect all rows on the page"></input>
                     </HeaderTemplate>
                    <HeaderStyle Paddings-PaddingTop="1" Paddings-PaddingBottom="1" 
                         HorizontalAlign="Center">
                        <Paddings PaddingTop="1px" PaddingBottom="1px"></Paddings>
                     </HeaderStyle>
                </dxwgv:GridViewCommandColumn>                
                <dxwgv:GridViewDataTextColumn Caption="" FieldName="USERID" Visible="false" ShowInCustomizationForm="false" VisibleIndex="1"></dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="登陆名" FieldName="LOGINNAME" VisibleIndex="2" Width="8%">
                    <HeaderStyle HorizontalAlign="center" />
                    <CellStyle HorizontalAlign="center"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="用户姓名" FieldName="USERNAME" VisibleIndex="3" Width="12%"  >
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="center"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="用户编号" FieldName="USERCODE" VisibleIndex="4" Width="12%">
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="center"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="部门" FieldName="DEPTNAME" VisibleIndex="5" Width="12%">
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="center"></CellStyle>
                </dxwgv:GridViewDataTextColumn>  
                <dxwgv:GridViewDataTextColumn Caption="职位" FieldName="POSNAME" VisibleIndex="6" Width="12%">
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="center"></CellStyle>
                </dxwgv:GridViewDataTextColumn> 
                <dxwgv:GridViewDataTextColumn Caption="级别" FieldName="CLASSNAME" VisibleIndex="7" Width="12%">
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="center"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="" FieldName="DELSIGN" VisibleIndex="8" Visible="false" ShowInCustomizationForm="false"></dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="状态" FieldName="" VisibleIndex="9" Width="6%">
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="center"></CellStyle>
                </dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="" FieldName="ORDERNO" VisibleIndex="10" Visible="false" ShowInCustomizationForm="false"></dxwgv:GridViewDataTextColumn>
                <dxwgv:GridViewDataTextColumn Caption="显示顺序" FieldName="" VisibleIndex="11" Width="8%">
                     <HeaderStyle HorizontalAlign="center" />
                     <CellStyle HorizontalAlign="center"></CellStyle>
                     <DataItemTemplate>
                        <nobr>
                            <asp:LinkButton ID="lnbMoveUp" runat=server>
                                <img src="../images/toolbar/moveup.gif" border="0" /></asp:LinkButton>
                            <asp:LinkButton ID="lnbMoveDown" runat=server>
                                <img src="../images/toolbar/movedown.gif" border="0" /></asp:LinkButton>                                                        
                        </nobr>
                    </DataItemTemplate>
                </dxwgv:GridViewDataTextColumn> 
                <dxwgv:GridViewDataColumn Caption="操作" VisibleIndex="12" Width="8%">
                    <HeaderStyle HorizontalAlign="center" />
                    <CellStyle HorizontalAlign="center"></CellStyle>
                    <DataItemTemplate>
                      <nobr>
                        <asp:LinkButton ID="lnbModifyRec" runat=server>修改</asp:LinkButton>
                        <asp:LinkButton ID="lnbDel" runat=server>删除</asp:LinkButton>
                        <asp:LinkButton ID="lnbResume" runat="server">恢复</asp:LinkButton>
                      </nobr>
                    </DataItemTemplate>
                </dxwgv:GridViewDataColumn>                    
           </Columns>
            <%-- 设置页脚中分页 --%>
            <SettingsPager PageSize=15 Mode="ShowPager" AlwaysShowPager=true
                 FirstPageButton-Visible=true LastPageButton-Visible=true  
                 FirstPageButton-Image-AlternateText="" LastPageButton-Image-AlternateText="尾页"
                 NumericButtonCount=5  SEOFriendly="Disabled"
                 PrevPageButton-Visible="true" NextPageButton-Visible="true"
                 ShowSeparators=true Position="Bottom">
                    <FirstPageButton Visible="True"></FirstPageButton>
                    <LastPageButton Visible="True">
                    <Image AlternateText="尾页"></Image>
                    </LastPageButton>
            </SettingsPager>
                 
            <%-- 复选框选择脚本事件--%>
            <ClientSideEvents SelectionChanged="function(s,e){OnGridSelectionChanged();}"
                 CustomizationWindowCloseUp="function(s,e){ UpdateCustomizationWindowValue();}"
             />
            
            <%-- 设置行样式--%>
            <Styles>
                <Row CssClass=""></Row>
                <AlternatingRow  CssClass="" Enabled="true"/>
                <SelectedRow  CssClass=""></SelectedRow>                
            </Styles>
            <%--  显示过滤行--%>
            <Settings ShowFilterRow="false" ShowPreview="True"/>  
            
            <%-- 自定义表头--%>
            <SettingsCustomizationWindow Enabled="true" />
        </dxwgv:ASPxGridView>
                </td>
            </tr>
        </table>
        <asp:LinkButton ID="lnbCallBack" runat="server" style="display:none" onclick="lnbCallBack_Click"></asp:LinkButton>
        <asp:LinkButton ID="lnbSel" runat="server" style="display:none" onclick="lnbSel_Click"></asp:LinkButton>
    </ccit:ActionForm>
</body>
</html>
